<template>
    <div style="width:100%">
        <el-row>
            <el-col :span="6" v-if="power('WJOB_YARDPLAN_YARDMGR')">
                <div class="modules">
                    <div class="title">
                        <span>堆场管理</span>
                    </div>
                    <div class="handle">
                        <ul>
                            <li @click="handleFormOpen('yardMsgForm')" v-if="power('WJOB_YARDPLAN_YARDMGR:ADD')">
                                <i class="iconfont icon-xinzeng"></i>
                                <span>新增</span>
                            </li>
                            <li @click="handleOpen({path:'/work/yardMsg',name:'堆场管理'})" v-if="power('WJOB_YARDPLAN_YARDMGR:QUERY')">
                                <i class="iconfont icon-chaxun"></i>
                                <span>查询</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </el-col>
            <el-col :span="6" v-if="power('WJOB_YARDPLAN_MACHINE')">
                <div class="modules">
                    <div class="title">
                        <span>场区机械配置</span>
                    </div>
                    <div class="handle">
                        <ul>
                            <li @click="handleFormOpen('yardMachineForm')" v-if="power('WJOB_YARDPLAN_MACHINE:ADD')">
                                <i class="iconfont icon-xinzeng"></i>
                                <span>新增</span>
                            </li>
                            <li @click="handleOpen({path:'/work/yardMachine',name:'场区机械配置'})" v-if="power('WJOB_YARDPLAN_MACHINE:QUERY')">
                                <i class="iconfont icon-chaxun"></i>
                                <span>查询</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </el-col>
            <el-col :span="6" v-if="power('WJOB_YARDPLAN_PLANTYPE')">
                <div class="modules">
                    <div class="title">
                        <span>堆场策划类型</span>
                    </div>
                    <div class="handle">
                        <ul>
                            <li @click="handleFormOpen('yardPlanTypeForm')" v-if="power('WJOB_YARDPLAN_PLANTYPE:ADD')">
                                <i class="iconfont icon-xinzeng"></i>
                                <span>新增</span>
                            </li>
                            <li @click="handleOpen({path:'/work/yardPlanType',name:'堆场策划类型'})" v-if="power('WJOB_YARDPLAN_PLANTYPE:QUERY')">
                                <i class="iconfont icon-chaxun"></i>
                                <span>查询</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </el-col>
            <el-col :span="6" v-if="power('WJOB_YARDPLAN_PLAN')">
                <div class="modules">
                    <div class="title">
                        <span>堆场策划</span>
                    </div>
                    <div class="handle">
                        <ul>
                            <li @click="handleFormOpen('yardStackPlanForm')" v-if="power('WJOB_YARDPLAN_PLAN:UPD')">
                                <i class="iconfont icon-xinzeng"></i>
                                <span>编辑</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </el-col>
            <el-col :span="6" v-if="power('WJOB_YARDPLAN_YARDMAP')">
                <div class="modules">
                    <div class="title">
                        <span>堆场图</span>
                    </div>
                    <div class="handle">
                        <ul>
                            <li @click="handleOpen({path:'/Work/yardMap',name:'堆场图'})" v-if="power('WJOB_YARDPLAN_YARDMAP:QUERY')">
                                <i class="iconfont icon-chaxun"></i>
                                <span>查询</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </el-col>
        </el-row>
        <component :is="component" ref="component"></component>
    </div>
</template>

<script>
    import yardMsgForm from './yardMsgForm.vue'
    import yardMachineForm from './yardMachineForm.vue'
    import yardPlanTypeForm from './yardPlanTypeForm.vue'
    import yardStackPlanForm from './yardStackPlanForm.vue'
    export default {
        name: "index",
        components: {
            yardMsgForm,
            yardMachineForm,
            yardPlanTypeForm,
            yardStackPlanForm
        },
        data() {
            return {
                component: ''
            }
        },
        methods: {
            handleOpen(val) {
                this.$store.commit('ADD_CACHED_VIEWS', val)
                this.$router.push(val.path)
            },
            handleFormOpen(ref) {
                this.component = ref
                this.$nextTick(() => {
                    this.$refs.component.dialogForm = true
                })
            }
        }
    }

</script>

<style scoped lang="scss">
    .modules {
        min-width: 200px;
        max-width: 270px;
        width: 90%;
        height: 150px;
        border: 1px solid #e4e7ed;
        border-radius: 10px;
        overflow: hidden;
        margin: 0 auto;
        margin-bottom: 15px;
    }

    .title {
        width: 100%;
        height: 45px;
        background: #ecf0fd;
        text-align: center;
        overflow: hidden;
        border-top-left-radius: 10px;
        border-top-right-radius: 10px;
        span {
            font-size: 18px;
            color: black;
            // font-weight: 600;
            display: block;
            margin-top: 10px;
        }
    }

    .handle {
        ul {
            list-style: none; // display: inline-block;
            width: 100%;
            text-align: center;
            li {
                display: inline-block;
                width: 45px;
                margin-top: 6px;
                width: 25%;
                text-align: center;
                i {
                    font-size: 45px;
                    color: #4c62e2;
                }
                span {
                    display: inherit;
                }
            }
        }
    }

</style>
